<?
include("session.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>电销助手外呼</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../../../webkit/utils/jquery.js"></script>
<script type="text/javascript" src="../../../webkit/grid/import.js"></script>
<script type="text/javascript" src="../../../webkit/dialog/import.js"></script>
</head>
<body bgccolor="#f4f4f4" style="margin:0px;overflow-x:hidden">

<table width=100% height=100% cellspacing=0 cellpadding=0>
	<tr bgcolor="white">
	<form name=f>
	<td height=30>　
	业务分组：<select id="agent_group" class='input'><option value=''>-请选择-</option></select>　
	<input type="button" value="查询" onclick="search()">　　
	</td>
	</tr>
	<tr>
	<td>
		<table id="flex1" style="display:none"></table>
	</td>
	</form>
	</tr>
</table>

<script>
	var agent_id = "<?echo $_SESSION['hngj_agent_id']?>";
	var h = window.screen.height-400; // 属于嵌入外部url，只能按screen高度大致计算
	//alert(h)
	if(h < 0) h = 'auto'
	$("#flex1").flexigrid({
		url: 'agent_query.php?action=list&call_result=0', // 默认只显示未呼的记录
		dataType: 'json',
		colModel : [
			{display: 'ID', name : 'a', width : 30, sortable : false, align: 'center'},
			{display: '座席工号', name : 'a', width : 120, sortable : false, align: 'center'},
			{display: '座席姓名', name : 'a', width : 120, sortable : false, align: 'center'},
			{display: '业务分组', name : 'agent_group', width : 150, sortable : true, align: 'center'},
			{display: '创建时间', name : 'b', width : 150, sortable : false, align: 'center'}
			],
		buttons : [
			{name: '新增', bclass: 'add', onpress : add},
			{name: '修改', bclass: 'edit', onpress : edit},
			{name: '删除', bclass: 'del', onpress : del}
		],
		async : true,
		usepager: true,
		title: '座席列表',
		useRp: true,
		rp: 12,
		showTableToggleBtn: false,
		width: 'auto',
		height: h,
		resizable : false,
		singleSelect : true
	});

	<?
	$add_url = "agent_panel.php?op=add";
	$edit_url = "agent_panel.php?op=edit&id="; 
	$del_url = "agent_query.php?action=del&id=";
	$dlg_size = "450, 120";
	require("../../grid_common_js.php");
	?>

    $('#flex1').dblclick( function (e) { 
        select_row_on_dblclick(e);
        edit();
    });


	function search() { 
		var url = "agent_query.php?action=list";
		if($("#agent_group").val()!="") {
            url += "&agent_group="+ encodeURI($("#agent_group").val());
        }    
		$('#flex1').flexOptions({'url': url}).flexReload(); 
	}

	$(function(){
		$.get("agent_query.php?action=get_group_options", function(data) {
			var arr = data.split("$");
			for(var i=0; i<arr.length; i++){
				var kv = arr[i].split(',');
				f.agent_group.options[i+1] = new Option(kv[1], kv[0]);
			}
		});
	});


</script>
</body>
</html>